package com.yangzb.flink.sql.sample.enums;

import lombok.Getter;

@Getter
public enum ProtocolTypeEnum {
    HTTP("1000"), FTP("2000"), JDBC("3000"),
    KAFKA("4000"), MQ("5000"), DATAFILE("6000"), HBASE("7000");


    private String code;

    ProtocolTypeEnum(String code) {
        this.code = code;
    }

    public static ProtocolTypeEnum getProtocolTypeEnum(String code) {
        if (code == null) {
            return null;
        }
        for (ProtocolTypeEnum protocolTypeEnum : ProtocolTypeEnum.values()) {
            if (code.equals(protocolTypeEnum.getCode())) {
                return protocolTypeEnum;
            }
        }

        return null;
    }

}
